package bookez.view.bean;

import java.math.BigDecimal;
import java.util.Date;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

import bookez.model.businessobject.BusType;
import bookez.model.businessobject.Route;
import bookez.model.businessobject.TripSchedule;
import bookez.model.businessobject.TripStatus;

@ManagedBean
@SessionScoped
public class TripScheduleBean extends BaseBean {
	
	/*-------------------------------------------------
	 * 	MessageID
	 *-------------------------------------------------*/
	
	public static class MessageId {
		
		public static final String SCHEDULE_EXISTS = "bookez.view.bean.TripScheduleBean.SCHEDULE_EXISTS";
		public static final String SCHEDULE_CREATED = "bookez.view.bean.TripScheduleBean.SCHEDULE_CREATED";
		//public static final String VALUE_REQUIRED
		
	}//end class MessageID
	
	/*-------------------------------------------------
	 * 	Methods
	 *-------------------------------------------------*/
	
	public static TripSchedule createTripSchedule( TripScheduleBean bean ) {
		
		TripSchedule schedule = new TripSchedule();
		
		schedule.setTripCode( bean.getTripCode() );
		schedule.setBoardingPoint( bean.getBoardingPoint() );
		schedule.setDroppingPoint( bean.getDroppingPoint() );
		schedule.setDepartureTime( bean.getDepartureTime() );
		schedule.setStartingDate( bean.getStartingDate() );
		schedule.setEndingDate( bean.getEndingDate() );
		schedule.setBusType( bean.getBusType() );
		schedule.setFare( bean.getFare() );
		schedule.setRoute( bean.getRoute() );
		schedule.setStatus( bean.getStatus() );
		
		return schedule;
	}//end method createTripSchedule
	
	public void clear() {
		setTripCode( "" );
		setDepartureTime( null );
		setStartingDate( null );
		setEndingDate( null );
		setBoardingPoint( "" );
		setDroppingPoint( "" );
		setFare( null );
		setRoute( null );
		setBusType( null );
	}
	
	
	/*-------------------------------------------------
	 * 	Properties
	 *-------------------------------------------------*/
	
	
	public String 		getTripCode() { return tripCode; }
	public void 		setTripCode(String tripCode) { this.tripCode = tripCode; }

	public Date 		getDepartureTime() { return departureTime; }
	public void 		setDepartureTime(Date departureTime) { this.departureTime = departureTime; }
	
	public Date 		getStartingDate() {	return startingDate; }
	public void 		setStartingDate(Date startingDate) { this.startingDate = startingDate; }
	
	public Date 		getEndingDate() { return endingDate; }
	public void 		setEndingDate(Date endingDate) { this.endingDate = endingDate; }

	public String 		getBoardingPoint() { return boardingPoint; }
	public void 		setBoardingPoint(String broadingPoint) { this.boardingPoint = broadingPoint; }
	
	public String 		getDroppingPoint() { return droppingPoint; }
	public void 		setDroppingPoint(String droppingPoint) { this.droppingPoint = droppingPoint; }

	public BigDecimal 	getFare() { return fare; }
	public void 		setFare(BigDecimal fare) { this.fare = fare; }
	
	public Route 		getRoute() { return route; }
	public void 		setRoute(Route route) { this.route = route; }

	public BusType 		getBusType() { return busType; }
	public void 		setBusType(BusType type) { this.busType = type; }
	
	public TripStatus 	getStatus() { return status; }
	public void		  	setStatus( TripStatus value ) { this.status = value; }
	
	/*-------------------------------------------------
	 * 	Instance Variables
	 *-------------------------------------------------*/

	private String tripCode;
	private Date departureTime;
	private Date startingDate;
	private Date endingDate;
	private String boardingPoint;
	private String droppingPoint;
	private BigDecimal fare;	
	private Route route;
	private BusType busType;
	private TripStatus status;
	
	
	private static final long serialVersionUID = -5967954368553843950L;
}//end class TripScheduleBean
